package com.fs.mymenu;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends Activity
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.activity_main);
	}

	// 创建选项菜单
	@Override
	public boolean onCreateOptionsMenu(Menu menu)
	{
		// 给选项菜单指定样式。
		getMenuInflater().inflate(R.menu.main, menu);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item)
	{
		switch (item.getItemId())
		{
		case R.id.one:
			Toast.makeText(MainActivity.this, "设置", Toast.LENGTH_SHORT).show();
			break;
		case R.id.two:
			Toast.makeText(MainActivity.this, "退出", Toast.LENGTH_SHORT).show();
			break;

		}
		return super.onOptionsItemSelected(item);
	}

}
